<template>
	<view class="page">
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<f-navbar :title="$t('pagetitle.result')" navbarType='2' @leftClick="$tools.goJump('/pages/my/myInfo',{},'','tab')"></f-navbar>
		<view class="u-flex result">
			<!-- <image class="icon" src="../../static/images/celebrities/icon-19.png"></image> -->
			<view class="icon u-flex">
				<block v-if="icon=='ok'">
					<u-icon name="checkmark" :color="PrimaryColor" size="80rpx"></u-icon>
				</block>
				<block v-if="icon=='no'">
					<u-icon name="close" :color="PrimaryColor" size="60rpx"></u-icon>
				</block>
			</view>
			<block v-if="type==1">
				<view class="title u-p-t-40">{{$t('success')}}</view>
				<view class="detail u-padding-24">{{$t('requestnext')}}</view>
			</block>
			<block v-if="type==2">
				<view class="title u-p-t-40">{{$t('pay_success')}}</view>
				<view class="detail u-padding-24">{{$t('pay_oknext')}}~</view>
			</block>
			<block v-if="type==0">
				<view class="title u-p-t-40">{{$t('pay_failed')}}</view>
				<view class="detail u-padding-24">{{$t('pay_again')}}~</view>
			</block>
		</view>
		<view class="u-padding-20 u-m-t-30">
			<u-button class="submitbtn" :style="'color:#fff;background: linear-gradient(to right, '+PrimaryColor+', #002884)'" @click="gotohome">
				{{$t('gotohomepage')}}
			</u-button>
		</view>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
import fNavbar from '@/components/module/f-navbar/f-navbar';
export default {
    components:{
        fNavbar
    },
	data() {
		return {
			icon:'ok',
			type:2,
		}
	},
	computed:{
	    ...mapState(['PrimaryColor'])
	},
	onLoad(e) {
		this.icon = e.icon || 'ok'
		this.type = e.type || '1'
		let goPayPageParameterData
		if (e.goPayPageParameterData!=undefined){
			goPayPageParameterData = JSON.parse(decodeURIComponent(e.goPayPageParameterData));
			this.type=goPayPageParameterData.payStatus
		}
		if (this.type==0)this.icon='no'
		this.gotohome()
	},
	methods:{
		gotohome(){
			setTimeout(()=>{
				this.$tools.goJump('/pages/my/myInfo',{},'','launch')
			},3000)
		}
	}
}
</script>

<style lang="scss" scoped>
.page{
	min-height: 100vh;
	background-color: #fff;
}
.result{
	padding-top: 144rpx;
	flex-direction: column;
	justify-content: center;
	.icon{
		justify-content: center;
		width: 140rpx;
		height: 140rpx;
		border-radius: 50%;
		background-color: #F2F2F2;
	}
	.title{
		font-weight: bold;
		font-size: 36rpx;
		color: #000;
	}
	.detail{
		font-size: 28rpx;
		color: #666;
	}
}
</style>